package com.groupbuying.cheetah.pay.controller;

import com.groupbuying.cheetah.common.PageUtils;
import com.groupbuying.cheetah.common.Query;
import com.groupbuying.cheetah.pay.domain.PayInfoDO;
import com.groupbuying.cheetah.pay.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping()
public class PayController {
    @Autowired
    private PayService payService;
    @GetMapping("/list")
    public PageUtils list(@RequestParam Map<String, Object> params) {
        //查询列表数据
        Query query = new Query(params);
        List<PayInfoDO> payInfoList = payService.list(query);
        int total = payService.count(query);
        PageUtils pageUtils = new PageUtils(payInfoList, total);
        return pageUtils;
    }

    @GetMapping("/getPayInfoByOrderId")
    public Map<String, String> getPayInfoByOrderId(String orderId) {
        return payService.getPayInfoByOrderId(orderId);
    }

}
